<%--
<!------------------------------------------------------------------------------
 - Copyright 2005 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   MENU_OBJECT_LABEL
 - AUTHOR           :   Victor Zheng 
 - DATE CREATE      :   2005/12/21
 - DESCRIPTION      :   a PAGE-EDIT CONTENT JSP file for the function, MENU_OBJECT_LABEL
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2005/12/21   Victor Zheng    1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page  import="com.erp.app.admin.menuObjectLabel.web.MenuObjectLabelAction" %>
<%@ page  import="com.erp.app.admin.menuObjectLabel.web.MenuObjectLabelRow" %>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="menuObjectLabelForm" scope="session" type="com.erp.app.admin.menuObjectLabel.web.MenuObjectLabelForm" />

<%
ArrayList menuObjectLabelList = menuObjectLabelForm.getMultiRows();
pageContext.setAttribute("menuObjectLabelList", menuObjectLabelList);
rowReadOnly = false;
TableSchema ts = menuObjectLabelForm.getTs();
%>

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>
	}

</script>

<body onLoad="javascript:doLoad();autofill_init();">
<html:form action="/menuObjectLabel">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>

<table class="table_top">

<tr>
	<td>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_CLEAR%>"
			styleClass="button1"/>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_ADD_ROW%>"
			styleClass="button1"/>
		<%--<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_COPY_ROW%>"
			styleClass="button1"/> --%>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_SAVE%>"
			styleClass="button1"/>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_REFRESH%>"
			styleClass="button1"/>
		<!--Print in English or Chinese? Uncomment where appropriate.-->
		<!--<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_PRINT%>"
			styleClass="button1"/>
		<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_PRINT_ENG%>"
			styleClass="button1"/>-->
		<!--<chtml:button form="menuObjectLabelForm" pageEvent="<%=MenuObjectLabelAction.ACTION_PRINT_CHN%>"
			styleClass="button1"/>-->
	</td>
</tr>

<tr>
	<td>

		<table class="table_crit">

		<tr class="col_label"> 
			<td class="col_label">&nbsp;</td>
			<td class="col_label_fr_to">&nbsp;</td>
			<%--<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_FROM");
				%>
				<%=webLabel%>
			</td>
			<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_TO");
				%>
				<%=webLabel%>
			</td>--%>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_GROUP_ID");
			%>
			<td class="col_label">
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
			</td>
			<td class = "col_value">
			<%ArrayList groupIdCollection = menuObjectLabelForm.getCodeDtlDropdownCollection(WebUtil.getAppropriateCompanyCode(session, WebUtil.getCodeSysParamId(ProjectConstants.CD_MENU_GROUP)), 
																							ProjectConstants.CD_MENU_GROUP, 
																							menuObjectLabelForm.getSrchGroupIdFr(), 
																							true); 
				pageContext.setAttribute("groupIdCollection",  groupIdCollection); %> 
				<html:select property  = "srchGroupIdFr" styleClass =  "t2"> 
					<html:option  value = ""></html:option> 
			        <html:options  collection = "groupIdCollection" 
								labelProperty = "dtlRefDesc" 
									 property = "refCode"/> 
				</html:select> 
			</td>
			<%--<td class="col_value">
				<html:text property="srchGroupIdFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<td class="col_value">
				<html:text property="srchGroupIdTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>--%>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_MENU_ID");
			%>
			<td class="col_label">
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
			</td>
			<td class = "col_value">
				<select name="srchMenuIdFr" class="t2">
					<option value = ""></option>
					<chtml:options table="T_MENU_OBJECT_LABEL"
									valuecolumn="DISTINCT MENU_ID"
									textcolumn="MENU_ID"
									selected="<%=menuObjectLabelForm.getSrchMenuIdFr()%>" />
				</select>
			</td>
			<%--<td class="col_value">
				<html:text property="srchMenuIdFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<td class="col_value">
				<html:text property="srchMenuIdTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>--%>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_OBJECT_ID");
			%>
			<td class="col_label">
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
			</td>
			<td class="col_value">
				<html:text property="srchObjectIdFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<%--<td class="col_value">
				<html:text property="srchObjectIdTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>--%>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_LANG_CODE");
			%>
			<td class="col_label">
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
			</td>
			<td class="col_value">
				<%--<html:text property="srchLangCodeFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>--%>
				<select name="srchLangCode" class="t2">
					<option value = ""></option>
					<chtml:options table="T_SYS_LANG"
									valuecolumn="LANG_CODE"
									textcolumn="LANG_CODE"								
									order="ORDER_SEQ"
									selected="<%=menuObjectLabelForm.getSrchLangCode()%>" />
				</select>

			</td>
			<%--<td class="col_value">
				<html:text property="srchLangCodeTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>--%>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_SRCH_OBJECT_NAME");
			%>
			<td class="col_label">
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
			</td>
			<td class="col_value">
				<html:text property="srchObjectNameFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<%--<td class="col_value">
				<html:text property="srchObjectNameTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>--%>
		</tr>		
		</table>

	</td>
</tr>

<tr>
	<td><font color='red'><html:errors/></font></td>
</tr>

<tr>
	<td>
	<%if(menuObjectLabelForm.getTotalPage() == 0 ) { %>
		&nbsp;
	<%} else { %>
		Page <%=menuObjectLabelForm.getCurrentPage()%> of <%=menuObjectLabelForm.getTotalPage()%>
	<%} %>
		<input type="button" value="&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=menuObjectLabelForm.ACTION_SCROLL_LEFT%>');" <%=menuObjectLabelForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&gt;&gt;" class="button1" onClick="javascript:doSubmit('<%=menuObjectLabelForm.ACTION_SCROLL_RIGHT%>');" <%=menuObjectLabelForm.getSidx() < Integer.parseInt(menuObjectLabelForm.getLastPageSidx()) ? "" : "disabled"%>>
	</td>
</tr>

</table>


<table class="table_grid">

	<tr class="grid_header">
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_SELECT");
		%>
		<td class="grid_header_col_narrow" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_DELETE");
		%>
		<td class="grid_header_col_narrow" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_GROUP_ID");
		%>
		<td class="grid_header_col" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_MENU_ID");
		%>
		<td class="grid_header_col" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_OBJECT_ID");
		%>
		<td class="grid_header_col" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_LANG_CODE");
		%>
		<td class="grid_header_col" nowrap>
				<bean:message key="label.general.mandatory.field"/>
				<span class="mandatory_label"><%=webLabel%></span>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_OBJECT_NAME");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_OBJECT_WEB_LABEL");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_OBJECT_TYPE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_TEXT_MAX_LEN");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_TEXT_SIZE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_TA_COL_SIZE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
			webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_TA_ROW_SIZE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
	</tr>

	<logic:iterate id="menuObjectLabelRow" name="menuObjectLabelList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(menuObjectLabelForm.getSidx())%>">

	<%
		MenuObjectLabelRow row = (MenuObjectLabelRow) menuObjectLabelRow;
	%>

	<% if(row != null) {%>

	<tr <%=(idx.intValue()%2 == 0)? "class='grid_result1'": "class='grid_result2'"%>>
		<td nowrap>
			<html:checkbox property="isSelected" name="menuObjectLabelRow" value="on" styleClass="checkbox1" disabled="<%=rowReadOnly%>" />
			<%--
			<input type=\"checkbox\" name=\"isSelected\" value=\"\" class=checkbox1 <%=rowReadOnly ? "disabled=\"true\"" : ""%> >
			--%>
		</td>
		<td nowrap>
			<html:checkbox property="isDelete" name="menuObjectLabelRow" value="on" styleClass="checkbox1" disabled="<%=rowReadOnly%>" />
			<%--
			<input type=\"checkbox\" name=\"isDelete\" value=\"\" class=checkbox1 <%=rowReadOnly ? "disabled=\"true\"" : ""%> >
			--%>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_GROUP_ID"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_GROUP_ID"));
			%>
			<logic:equal name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<html:text property="groupId" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getGroupId())%>"/>
			</logic:equal>
			<logic:notEqual name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<bean:write name="menuObjectLabelRow" property="groupId" filter="true"/>
				<html:hidden property="groupId" value="<%=CommonUtil.nullToString(row.getGroupId())%>"/>
			</logic:notEqual>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_MENU_ID"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_MENU_ID"));
			%>
			<logic:equal name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<html:text property="menuId" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getMenuId())%>"/>
			</logic:equal>
			<logic:notEqual name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<bean:write name="menuObjectLabelRow" property="menuId" filter="true"/>
				<html:hidden property="menuId" value="<%=CommonUtil.nullToString(row.getMenuId())%>"/>
			</logic:notEqual>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_OBJECT_ID"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_OBJECT_ID"));
			%>
			<logic:equal name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<html:text property="objectId" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getObjectId())%>"/>
			</logic:equal>
			<logic:notEqual name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<bean:write name="menuObjectLabelRow" property="objectId" filter="true"/>
				<html:hidden property="objectId" value="<%=CommonUtil.nullToString(row.getObjectId())%>"/>
			</logic:notEqual>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_LANG_CODE"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_LANG_CODE"));
			%>
			<logic:equal name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<html:text property="langCode" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getLangCode())%>"/>
			</logic:equal>
			<logic:notEqual name="menuObjectLabelRow" property="rowMode" value="<%=ProjectConstants.ROW_MODE_CREATE%>">
				<bean:write name="menuObjectLabelRow" property="langCode" filter="true"/>
				<html:hidden property="langCode" value="<%=CommonUtil.nullToString(row.getLangCode())%>"/>
			</logic:notEqual>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_OBJECT_NAME"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_OBJECT_NAME"));
			%>
			<html:text property="objectName" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getObjectName())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_OBJECT_WEB_LABEL"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_OBJECT_WEB_LABEL"));
			%>
			<html:text property="objectWebLabel" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getObjectWebLabel())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_OBJECT_TYPE"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_OBJECT_TYPE"));
			%>
			<html:text property="objectType" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getObjectType())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_TEXT_MAX_LEN"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_TEXT_MAX_LEN"));
			%>
			<html:text property="textMaxLen" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getTextMaxLen())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_TEXT_SIZE"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_TEXT_SIZE"));
			%>
			<html:text property="textSize" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getTextSize())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_TA_COL_SIZE"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_TA_COL_SIZE"));
			%>
			<html:text property="taColSize" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getTaColSize())%>"/>
		</td>
		<td nowrap>
			<%
			colSize = String.valueOf(ts.getColSizeByObjectId("LBL_GRID_TA_ROW_SIZE"));
			displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_GRID_TA_ROW_SIZE"));
			%>
			<html:text property="taRowSize" styleClass="textbox1" readonly="<%=rowReadOnly%>" size="<%=colSize%>" maxlength="<%=displaySize%>" value="<%=CommonUtil.nullToString(row.getTaRowSize())%>"/>
		</td>
	</tr>

	<% } // end if(row != null) %>

	<html:hidden property="idx" value="<%=row.getIdx()%>" />
	<html:hidden property="rowMode"  value="<%=row.getRowMode()%>"/>

	</logic:iterate>

</table>

</html:form>
